
# Packages
#install.packages("mokken")
library(mokken)


### 2017 ###

# Data
data2017 <- read.csv("Scaling2017.csv")


# Immigration
newdata <- data2017[,c("q2rev","q22","q23rev")]
imm <- na.omit(newdata)
coefH(imm)
mon <- check.monotonicity(imm)
summary(mon)
check.reliability(imm)




### 2019 ###


# Data
data2019 <- read.csv("Scaling2019.csv")


# Security
newdata <- data2019[,c("q22","q27")]
sec <- na.omit(newdata)
coefH(sec)
mon <- check.monotonicity(sec)
summary(mon)
check.reliability(sec)


# Immigration
newdata <- data2019[,c("q6","q19","q20","q21rev")]
imm <- na.omit(newdata)
coefH(imm)
mon <- check.monotonicity(imm)
summary(mon)
check.reliability(imm)





